package net.chemistry;

import static net.chemistry.AtomType.ALKALI_EARTH_METAL;
import static net.chemistry.AtomType.ALKALI_METAL;
import static net.chemistry.AtomType.HALOGEN;
import static net.chemistry.AtomType.HYDROGEN_TYPE;
import static net.chemistry.AtomType.NOBLE_GAS;
import static net.chemistry.AtomType.NON_METAL;
import static net.chemistry.AtomType.POOR_METAL;
import static net.chemistry.AtomType.SEMI_METAL;
import static net.chemistry.AtomType.TRANSITION_METAL;
import static org.lwjgl.util.ReadableColor.BLACK;
import static org.lwjgl.util.ReadableColor.RED;

import org.lwjgl.util.Color;
import org.lwjgl.util.ReadableColor;

public enum AtomID
{
	HYDROGEN (HYDROGEN_TYPE, 1.008, 2.20, "H"), 
	HELIUM (NOBLE_GAS, 4.0026, "He"), 
	LITHIUM (ALKALI_METAL, 6.94, 0.98, "Li"),
	BERYLLIUM (ALKALI_EARTH_METAL, 9.0122, 1.57, "Be"),
	BORON (SEMI_METAL, 10.81, 2.04, "B"),
	CARBON (NON_METAL, 12.011, 2.55, "C", BLACK),
	NITROGEN (NON_METAL, 14.007, 3.04, "N", new Color(0,0,70)),
	OXYGEN (NON_METAL, 15.999, 3.44, "O", RED),
	FLUORINE (HALOGEN, 18.998, 3.98, "F", new Color(75,80,0)),
	NEON (NOBLE_GAS, 20.180, "Ne"),
	SODIUM (ALKALI_METAL, 22.990, 0.93, "Na"),
	MAGNESIUM (ALKALI_METAL, 24.305, 1.31, "Mg"),
	ALUMINUM (POOR_METAL, 26.982, 1.61, "Al"),
	SILICON (SEMI_METAL, 28.085, 1.90, "Si"),
	PHOSPHORUS (NON_METAL, 30.974, 2.19, "P", new Color(50,90,30)),
	SULFUR (NON_METAL, 32.06, 2.58, "S", new Color(100,100,0)),
	CHLORINE (HALOGEN, 35.45, 3.16, "Cl", new Color(0,100,0)),
	ARGON (NOBLE_GAS, 39.984, "Ar"),
	POTASSIUM (ALKALI_METAL, 39.098, 0.82, "K"),
	CALCIUM (ALKALI_EARTH_METAL, 24.305, 1.00, "Ca"),
	SCANDIUM (TRANSITION_METAL, 44.956, 1.36, "Sc"),
	TITANIUM (TRANSITION_METAL, 47.867, 1.54, "Ti"),
	VANADIUM (TRANSITION_METAL, 50.942, 1.63, "V"),
	CHROMIUM (TRANSITION_METAL, 51.996, 1.66, "Cr"),
	MANGANESE (TRANSITION_METAL, 54.938, 1.55, "Mn"), 
	IRON (TRANSITION_METAL, 55.845, 1.83, "Fe", new Color(100,40,100)), 
	COBALT (TRANSITION_METAL, 58.933, 1.88, "Co"), 
	NICKLE (TRANSITION_METAL, 58.693, 1.91, "Ni"), 
	COPPER (TRANSITION_METAL, 63.546, 1.90, "Cu"), 
	ZINC (TRANSITION_METAL, 65.38, 1.65, "Zn"), 
	GALLIUM (POOR_METAL, 69.723, 1.81, "Ga"),
	GERMANIUM (SEMI_METAL, 72.63, 2.01, "Ge"), 
	ARSENIC (SEMI_METAL, 74.922, 2.18, "As"), 
	SELENIUM (NON_METAL, 78.96, 2.55, "Se"),
	BROMINE (HALOGEN, 79.904, 2.96, "Br"), 
	KRYPTON (NOBLE_GAS, 83.798, 3.00, "Kr"),
	RUBIDIUM (ALKALI_METAL, 85.468, 0.82, "Rb"), 
	STRONTIUM (ALKALI_EARTH_METAL, 87.62, 0.95, "Sr"),
	YTTRIUM (TRANSITION_METAL, 88.906, 1.22, "Y"),
	ZIRCONIUM (TRANSITION_METAL, 91.224, 1.33, "Zr"),
	NIOBIUM (TRANSITION_METAL, 92.906, 1.6, "Nb"),
	MOLYBDENUM (TRANSITION_METAL, 95.96, 2.16, "Mb"),
	TECHNECIUM (TRANSITION_METAL, 97.91, 1.9, "Tc"),
	RUTHENIUM (TRANSITION_METAL, 101.07, 2.2, "Ru"),
	RHODIUM (TRANSITION_METAL, 102.91, 2.28, "Rh"),
	PALLADIUM (TRANSITION_METAL, 106.42, 2.2, "Pd"),
	SILVER (TRANSITION_METAL, 107.87, 1.93, "Ag"),
	CADMIUM (TRANSITION_METAL, 112.41, 1.69, "Cd"), 
	INDIUM (TRANSITION_METAL, 114.82, 1.78, "In"), 
	TIN (POOR_METAL, 118.71, 1.96, "Sn"),
	ANIMONY (SEMI_METAL, 121.76, 2.05, "Sb"),
	TELLURIUM (SEMI_METAL, 127.60, 2.1, "Te"), 
	IODINE (HALOGEN, 126.90, 2.66, "I"), 
	XENON (NOBLE_GAS, 131.29, 2.6, "Xe");

	public static final AtomID[] Nobles= {HELIUM, NEON, ARGON, KRYPTON, XENON};
	
	public final double AMUweight, Gweight, Xpauling;
	
	public final String abbrev;
	
	public final AtomType atomtype;
	
	public final ReadableColor atomcolor;

	public static final double AVROGADO = 6.0221415e+23;
	
	private AtomID(AtomType atomtype, double AMUweight, String abbrev)
	{
		this(atomtype, AMUweight, 0, abbrev, atomtype.defaultatomcolor);
	}
	
	private AtomID (AtomType atomtype, double AMUweight, double X, String abbrev)
	{
		this(atomtype, AMUweight, X, abbrev, atomtype.defaultatomcolor);
	}
	
	private AtomID(AtomType atomtype, double AMUweight, double X, String abbrev, ReadableColor atomcolor)
	{
		this.atomtype = atomtype;
		this.abbrev = abbrev;
		this.AMUweight = AMUweight;
		this.Gweight = AMUweight / AVROGADO;
		this.atomcolor = atomcolor;
		this.Xpauling = X;
	}
	
	public int number()
	{
		return (this.ordinal() + 1);
	}
}
